import BuffUtil from '@/BuffUtil';
import SelectUtil from '@/SelectUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 震撼大地
 **/
export default class BossSpell_ShackEarch extends AbilityBase {
    static instance: BossSpell_ShackEarch;
    buffType: AppBuffType = {
        id: 'buff_BossSpell_ShackEarch',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        attribute: {
            attackSpd_p: -2,
            move_speed: -100,
        },
        targetAttach: 'origin',
        targetArt: 'Abilities\\Spells\\Orc\\StasisTrap\\StasisTotemTarget.mdl',
        isDebuff: true,
        dur: 5,
    };
    constructor(id: string = 'Mxg2') {
        super(id);
        BossSpell_ShackEarch.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BossAbilityManagerInstance.text('震撼大地', source);
        let es = SelectUtil.getEnemyUnitsInRange(source, 425);
        for (let item of es) {
            BuffUtil.addBuff(item, this.buffType.id);
            DamageSystemInstance.applyEarthDamage(item, source, 1000, null);
        }
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
